function Csnid_WC_TreeList(inlExpend, inlPinch, iniExpend, iniPinch) {
    this.lExpend = null;
    this.lPinch = null;   
    this.tExpend = null;
    this.tPinch = null;
    if (typeof(inlExpend) == "string") {
        this.lExpend = inlExpend.substring(inlExpend.lastIndexOf("/") + 1);
    }
    else {
        this.lExpend = '<%=WebResource("Csnid.Web.UI.WebControls.TreeListView.WCL_Resource.lminus.gif")%>';
    }
    if (typeof(inlPinch) == "string") {
        this.lPinch = inlPinch.substring(inlPinch.lastIndexOf("/") + 1);
        
    }
    else {
        this.lPinch =  '<%=WebResource("Csnid.Web.UI.WebControls.TreeListView.WCL_Resource.lplus.gif")%>';
    }
    if (typeof(iniExpend) == "string") {
        this.tExpend = iniExpend.substring(iniExpend.lastIndexOf("/") + 1);
        
    }
    else {
        this.tExpend = '<%=WebResource("Csnid.Web.UI.WebControls.TreeListView.WCL_Resource.tminus.gif")%>';
    }
    if (typeof(iniPinch) == "string") {
        this.tPinch = iniPinch.substring(iniPinch.lastIndexOf("/") + 1);
    }
    else {
        this.tPinch = '<%=WebResource("Csnid.Web.UI.WebControls.TreeListView.WCL_Resource.tplus.gif")%>';
    }
};
Csnid_WC_TreeList.prototype.ClickNode = function(img, isBottom, tableId) {
    var imgId = img.src.substring(img.src.lastIndexOf("/") + 1);
    var url = img.src.substring(0, img.src.lastIndexOf("/") + 1);
    var oldTrId = img.parentElement.parentElement.id;
    var newTrId = oldTrId.substring(oldTrId.indexOf("_") + 1);
      
    if(isBottom) {
        if(imgId == this.lExpend) {
            img.src =  url+ this.lPinch;
//            img.parentElement.id = this.lPinch;
            this.PinchNode(newTrId,oldTrId,tableId);
        }
        else {
            img.src = url + this.lExpend;
//            img.parentElement.id = this.lExpend;
            this.ExpendNode(newTrId,oldTrId,tableId);
        }   
    }
    else {
        if(imgId == this.tExpend) {
            img.src =  url+ this.tPinch;
//            img.parentElement.id = this.tPinch;
            this.PinchNode(newTrId,oldTrId,tableId);
        }
        else {
            img.src = url + this.tExpend;
//            img.parentElement.id = this.tExpend;
            this.ExpendNode(newTrId,oldTrId,tableId);
        }   
    }
}
Csnid_WC_TreeList.prototype.ExpendNode = function(newId,oldId,tableId) {
    var tree = document.getElementById(tableId);
    for(var i = 0; i < tree.rows.length; i++) {
        if(tree.rows[i].id.indexOf(newId) != -1 && tree.rows[i].id != oldId) {
            var isExpend = true;
            var pId = tree.rows[i].id;
           
            while(pId != oldId) {
                for(var j = 0; j < 2; j++) pId = pId.substring(0, pId.lastIndexOf("/"));
                var parent = document.getElementById(pId);
                if(parent != null) {
                    var tempId = parent.cells[2].id;
                    if(tempId == this.lExpend || tempId == this.tExpend || tempId == "") {
                    }
                    else {
                        isExpend = false;
                        break;
                    }
                }
                else
                    break;
            }
            if(isExpend) tree.rows[i].style.display="block";  
        }
    }
}
Csnid_WC_TreeList.prototype.PinchNode = function (newId,oldId,tableId) {
    var tree = document.getElementById(tableId);
    for(var i = 0; i < tree.rows.length; i++) {
        if(tree.rows[i].id.indexOf(newId) != -1 && tree.rows[i].id != oldId) {
            tree.rows[i].style.display = "none";
        }
    }
}

